function [flag] = mitigation(DevSettings,STFT_SETTINGS)
flag                 = true;     % if a mitigation process is successful,flag = true
dataType             = 'double'; % BladeRF receiver stored data as double type
mitigation_gap       = 1;        % unit [s]
PAlert               = 1e-4;

mitigationFileName1I = ['TF_Mitigation_dataI','.txt'];
mitigationFileName1Q = ['TF_Mitigation_dataQ','.txt'];
mitigationFileName2I = ['TFRIM_Mitigation_dataI','.txt'];
mitigationFileName2Q = ['TFRIM_Mitigation_dataQ','.txt'];
fidI = fopen(fullfile(DevSettings.HistoryDataPath,DevSettings.HistoryDataNameI),'r');
fidQ = fopen(fullfile(DevSettings.HistoryDataPath,DevSettings.HistoryDataNameQ),'r');
if (fidI>0)&&(fidQ>0)
    blksize = ceil(mitigation_gap * DevSettings.Fs);% length of block
    blkCnt=0;                                           % counter of block
    fidI1=fopen(fullfile(DevSettings.HistoryDataPath,mitigationFileName1I),'w+');
    fidQ1=fopen(fullfile(DevSettings.HistoryDataPath,mitigationFileName1Q),'w+');
    fidI2=fopen(fullfile(DevSettings.HistoryDataPath,mitigationFileName2I),'w+');
    fidQ2=fopen(fullfile(DevSettings.HistoryDataPath,mitigationFileName2Q),'w+');
    hwb = waitbar(0,'Mitigation');
    while blkCnt*1000<=DevSettings.ST % comparition unit [ms]
        [dataI,countI]=fread(fidI,blksize,dataType);
        [dataQ,countQ]=fread(fidQ,blksize,dataType);
        dataI = dataI.';
        dataQ = dataQ.';
        if countI~=countQ
            warning('Failed to read IQ files');
            flag = false;
            break;
        else
            count = countI;
        end
        idx               = (blkCnt*blksize+1):blkCnt*blksize+count;
        t                 = idx/DevSettings.Fs;
        data              = dataI+1j*dataQ;
        [Fdata,~,~]       = F_STFT2(t,data,STFT_SETTINGS);
        mitigation_th     = 2*sqrt(-log(PAlert)/pi)/mean(mean(Fdata));
        F1=zeros(size(Fdata)); % Traditional Time-Frequency Domain Method
        F1(abs(Fdata)<=mitigation_th)=Fdata(abs(Fdata)<=mitigation_th);
        F2=Fdata./abs(Fdata); % TFRIM method(Laplace)
        F2(isnan(F2))=0;
        res1=inverse_STFT(F1,STFT_SETTINGS);% Traditional mitigation's TF sythesis
        res2=inverse_STFT(F2,STFT_SETTINGS);% TFRIM mitigation's TF sythesis
        if(length(res1)>count),res1=res1(1:count);end
        if(length(res2)>count),res2=res2(1:count);end
        fwrite(fidI1,real(res1).',dataType);
        fwrite(fidQ1,imag(res1).',dataType);
        fwrite(fidI2,real(res2).',dataType);
        fwrite(fidQ2,imag(res2).',dataType);
        blkCnt=blkCnt+1;
        
        str=sprintf('当前完成%.f%%,当前%.f ms',blkCnt*mitigation_gap*1e5/DevSettings.ST,blkCnt*mitigation_gap*1e3);
        waitbar(blkCnt*mitigation_gap*1e3/DevSettings.ST,hwb,str);
    end
    if flag
        str = [num2str(blkCnt*mitigation_gap*1e3),' second data''s mitigation finished'];
        disp(str)
        close(hwb);
    else
        warning('Mitigation Failed!!!')
        close(hwb);
    end
else
    warning('Failed to read files,Mitigation Exit!')
    flag=false;
    return;
end
end